package com.xueyi.system.BaseRecruitWork.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.xueyi.system.BaseRecruitWork.domain.po.BaseRecruitWorkPo;
import com.xueyi.system.BaseRecruitWork.domain.query.BaseRecruitWorkQuery;
import com.xueyi.system.BaseRecruitWork.domain.dto.BaseRecruitWorkDto;
import com.xueyi.system.BaseRecruitWork.mapper.BaseRecruitWorkMapper;
import com.xueyi.system.BaseRecruitWork.service.IBaseRecruitWorkService;
import com.xueyi.system.BaseRecruitWork.manager.IBaseRecruitWorkManager;
import com.xueyi.common.web.entity.service.impl.BaseServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用工记录管理 服务层处理
 *
 * @author xueyi
 */
@Service
public class BaseRecruitWorkServiceImpl extends BaseServiceImpl<BaseRecruitWorkQuery, BaseRecruitWorkDto, IBaseRecruitWorkManager> implements IBaseRecruitWorkService {


    @Autowired
    private BaseRecruitWorkMapper baseRecruitWorkMapper;

    /**
     * 查询用工记录对象列表 | 数据权限 | 附加数据
     *
     * @param baseRecruitWork 用工记录对象
     * @return 用工记录对象集合
     */
    @Override
    //@DataScope(userAlias = "createBy", mapperScope = {"BaseRecruitWorkMapper"})
    public List<BaseRecruitWorkDto> selectListScope(BaseRecruitWorkQuery baseRecruitWork) {
        return baseManager.selectListExtra(baseRecruitWork);
    }


    /**
     * 最近七天用工时长统计
     * @param dateTime
     * @return
     */
    public List<BaseRecruitWorkPo> getWorkTime(String dateTime){
        QueryWrapper<BaseRecruitWorkPo> queryWrapper = new QueryWrapper<>();
        queryWrapper.like("date",dateTime);
        List<BaseRecruitWorkPo> baseRecruitWorkPos = baseRecruitWorkMapper.selectList(queryWrapper);
        return baseRecruitWorkPos;
    }

}
